package com.example.cmh.mapper;

import com.example.cmh.pojo.Meeting;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

@Mapper
public interface MeetingMapper {
    
    int insert(Meeting meeting);
    
    int deleteById(Integer meetingId);
    
    int updateById(Meeting meeting);
    
    Meeting selectById(Integer meetingId);
    
    List<Meeting> selectMeetings(@Param("meetingName") String meetingName,
                                @Param("creatPerson") String creatPerson,
                                @Param("startTime") Date startTime,
                                @Param("meetingStatus") Integer meetingStatus,
                                @Param("creatPersonId") Integer creatPersonId);
    
    // 分页查询会议列表
    List<Meeting> selectMeetingsWithPage(@Param("meetingName") String meetingName,
                                        @Param("creatPerson") String creatPerson,
                                        @Param("startTime") Date startTime,
                                        @Param("meetingStatus") Integer meetingStatus,
                                        @Param("creatPersonId") Integer creatPersonId,
                                        @Param("offset") int offset,
                                        @Param("limit") int limit);
    
    // 统计符合条件的会议总数
    long countMeetings(@Param("meetingName") String meetingName,
                      @Param("creatPerson") String creatPerson,
                      @Param("startTime") Date startTime,
                      @Param("meetingStatus") Integer meetingStatus,
                      @Param("creatPersonId") Integer creatPersonId);
    
    int updateMeetingStatus(@Param("meetingId") Integer meetingId, @Param("status") Integer status);
} 